import os

# 打开文件
# f = open("../第10章-模块/22.txt", encoding='utf-8')  # 必须加utf-8，无法编码gbk

# 绝对路径
path = os.getcwd()
# print(path)  # E:\exam\python\python学习\第11章-文件
filename = path + '/resources/11.txt'
f = open(filename, mode='r', encoding='utf-8')  # 绝对路径

# 读取文件
# context = f.read(5) # 读取5个字符，换行符也算
context = f.readline()
# context = f.readlines()
print(context)

# 关闭文件
f.close()
